@using Radzen.Blazor

@if (Heading)
{
    <h1>@Name</h1>

    <p>Demonstration and configuration of the Radzen Blazor <strong>@Name</strong> component.</p>
}

@if (Documentation)
{
    <a class="documentation-link" target="blank" href="@DocumentationUrl"><RadzenIcon Icon="help" /> Documentation </a>
}

<RadzenTabs>
    <Tabs>
        <RadzenTabsItem Text="Example" Icon="apps">
            @ChildContent
        </RadzenTabsItem>
        <RadzenTabsItem Text="Source" Icon="code">
            <CodeViewer PageName="@($"{Name}Page.razor")" />
        </RadzenTabsItem>
    </Tabs>
</RadzenTabs>

@code {
    [Parameter]
    public RenderFragment ChildContent { get; set; }

    [Parameter]
    public string Name { get; set; }

    [Parameter]
    public bool Heading { get; set; } = true;

    [Parameter]
    public bool Documentation { get; set; } = true;

    public string DocumentationUrl 
    { 
        get
        {
            return $"https://www.radzen.com/documentation/blazor/{Name.ToLower()}/";
        }
    }
}